wrap.)2). Center horizontally. margin:0 Auto; (of course not everything)3, if you need to give the contents of a tag style, you need to set display:block; (common in navigation labels)4, the FF and IE to the BOX understanding of the difference caused by 2px is also set to float div under IE margin doubled and so on.5, UL label under FF The default is List-style
move the Javascript list box left and right Beijing Shanghai Guangzhou Shenzhen >>"/> Chengdu Shenzhen Nanjing Tianjin
A troublesome function previously written:
// Function additem (){// Var dsource = Document. getelementbyid
,height,width's Fool-solving skillsAttention is skill, not method:Write the standard head.High as far as possible with padding, careful with margin,height as far as possible to make up 100%, the parent height has a fixed value of the child height not 100%, the child is all floating when the bottom fill an empty clear:both divWidth as far as possible with margin, careful to use padding,width calculate the actual to subtract padding
List class
1. The
this to solve multiple div alignment when the spacing is not right,The principle of clear float can be found in [how to clear Floatswithout Structural Markup]Add the following code to the global CSS and add class= "Clearfix" to the div that needs to be closed.Code:Iii. other compatibility tips (quite useful)Setting padding to Div after 1,ff will cause width and height to increase, but IE will not. (Can be resolved with!important)2, centering problem.
. posTop
IE: Yes.
FF: No.
Generic: object. offsetLeft and object. offsetTop.
// The height and width of the form
IE: document. body. offsetWidth and document. body. offsetHeight. Note: The page must have a body tag.
FF: window. innerWidth and window. innerHegiht,
And document.documentelement.clientwidthand document.doc umentElement. clientHeight.
Generic: document. body. clientWidth and document. body. cli
that of the above two methods. onclick only executes one process, while attachevent and addeventlistener execute one process list, that is, multiple processes. For example, both func1 and func2 are executed in element. attachevent ("onclick", func1); element. attachevent ("onclick", func2.
(9) Custom Attributes of tags
IE: If you define an attribute value for the label div1, you can obtain this value using div1.value and div1 ["value.
, the UL label below the FF default has List-style and padding. It is best to make a statement beforehand to avoid unnecessary trouble. (Common in navigation labels and content lists)6, as an external wrapper div do not set dead height, preferably plus overflow:hidden. To achieve a high degree of adaptability.7, about the hand-shaped cursor. Cursor:pointer. And hand only applies to IE. Paste code:
Compatib
the same height as the current Div, and then pass the Vertical-align:middle. (Note that the content is not wrapped.)
2). Horizontally centered. margin:0 Auto; (certainly not omnipotent)
3, if you need to add a style to the contents of a label, you need to set display:block (common to navigation tags)
4, FF and IE on the BOX understanding of the difference between the 2px is also set for float div in IE under the margin doubling and so on.
5, the
understanding box leads to the 2px difference. There are also issues such as Div set to float and margin doubling under IE.5. Different performances of UL:UL labels have list-style and padding by default under ff. It is recommended to declare them in advance to avoid unnecessary troubles. (common in navigation labels and content lists)6. Do not set the height of the external wrapper Div. It is best to add
// Display attributesDisplayPositionFloatClearCursor...
// AttributesMarginPaddingWidthHeight
/* Typographical */Vertical-alignWhite-spaceText-DecorationText-align...
/* Text */ColorFontContent
/* Border backgroundThe reason why boder and background are put at the end is that the modification frequency is more frequent than before, and it is convenient to view them at the end. */BorderBackground}
ProgramCode:
. Class {Background-color: # FFFF00;/* all browsers */* Background-co
Parameters:Clip: do not show the omitted mark (...), but simply crop(Clip is not commonly used !)Ellipsis: when the object text overflows, the omission mark (...) is displayed (...)
Note:Sets or retrieves whether an omission mark (...) is used to indicate text overflow in the object.Note that the text-overflow: ellipsis attribute has no effect in ff.
Example:Div {text-overflow: Clip ;}
Text-overflow is a special style. We can use it instead o
above two methods is not the same,
OnClick only executes a process, and attachevent and AddEventListener execute a list of processes, that is, multiple processes.
For example: Element.attachevent ("onclick", func1);
Element.attachevent ("onclick", Func2) so func1 and Func2 will be executed.
Custom Properties for labels
IE: If a property value is defined for the label DIV1, the value can be obtained Div1.value and div1["value".
FF Firebug, not only can test JS can also check CSS errors, is generally used.But it is mainly to check the FF error, IE is powerless.To test IE, use ietester, it can test almost all versions of IE (1.0 I'm afraid it won't be tested), usage is also very convenient.As for JS to different browser compatibility considerations, indeed a lot, the following is only part of you, general advice or use jquery,protot
Differences between JS and CSS in IE and Firefox (FF)
CSS:
1.
In the UL tag, FF has a padding value, but there is no margin value. In ie, the opposite is true.
Solution: Set UL's padding and margin to 0 (or not 0), for example, padding: 0; margin: 0; List-style: none;
JS:
1.
In IE, innertext is not in ff, and t
Differences between js and css in IE and FireFox (FF)Css: 1.In the ul tag, FF has a padding value, but there is no margin value. In IE, the opposite is true.Solution: Set ul's padding and margin to 0 (or not 0), for example, padding: 0; margin: 0; list-style: none;Js: 1.In IE, innerText is not in FF, and textContent is
-block;}/* Hide from IE MAC/. clearfix {Display:block;}/End Hide from IE Mac//End of Clearfix */Third, other compatibility skills1, FF setting padding after the div will cause width and height to increase, but IE will not. (Can be resolved with!important)2, centering problem.1). Center vertically. Set Line-height to the same height as the current Div, and then through Vertical-align:middle. (Note that the content does not wrap.)2). Center horizontally
JS and CSS are different in IE and Firefox (FF)
CSS:
1.
The UL tag in FF has a padding value, but there is no margin value, and in IE is the opposite
Solution: The UL padding and margin are set to 0 (also can not 0) such as: Padding:0;margin:0;list-style:none;
JS:
1.
IE innertext in FF, using Textcontent;
eg
In JavaScript For browser compatibility-solutions to browser compatibility issues have been tested in IE, FF, Chrome, in IE, FF, and Chrome tests, the CSS compatibility and JS compatibility in the browser have been briefly described, now, we will continue to briefly describe the compatibility of CSS in the browser.
1) the list cannot wrap.
Problem:
Li is set to
= "clearfix" can be done. Third, other compatibility skills (the following excerpt from the Internet, does not mean that individuals fully agree with their solutions) 1, FF setting padding after the div will cause width and height to increase, but IE will not. (Can be resolved with!important) 2, centering problem. 1). Center vertically. Set Line-height to the same height as the current Div, and then through Vertical-align:middle. (Note that the cont
the block.· Blocks in FF are displayed in accordance with the floating principle after using the floating attribute, but IE does not follow the floating principle. Therefore, in the use of floating chunks to remember the parent block also floating out of the document flow, clear floating, etc. to ensure browser compatibility.· There is a big difference between IE and FF in the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.